{% extends "employee/employee_base.html"%}
{% block currentPath %}
 >> <a href="/employee/products/">Products</a> >> Categories Manage   
{% endblock %}

{% block content %}
  <input type="button" value="+ Add new category" onclick="window.location.href='/employee/products/category/add'" />
  <table class="table-list" border=0 cellspacing=0 cellpadding=3>
    <tr>
        <th>ID</th><th colspan=2>Category Name</th><th>Operation</th>
    </tr>
    {% for category in categories %}
    <tr>
        <td>{{category.id}}</td>
        <td colspan=2>{{category.name}} <a href="/employee/products/subcategory/add">[New subcategory]</a></td>
        <td>
            <a href="/employee/products/category/edit/{{category.id}}">[Edit]</a> | 
            <a href="/employee/products/category/delete/{{category.id}}" class="need-confirm-delete-link">[Delete]</a>
        </td>
    </tr>
        {% for subcategory in category.subcategories.all %}
        <tr>
            <td>&nbsp;</td><td>&nbsp;</td><td>{{subcategory.name}}</td>
            <td><a href="/employee/products/subcategory/edit/{{subcategory.id}}">[Edit]</a> |
            <a href="/employee/products/subcategory/delete/{{subcategory.id}}" class="need-confirm-delete-link">[Delete]</a></td>
        </tr>    
        {% endfor %}
    {% endfor %}
  </table>
{% endblock %}